package database.objects;

import java.sql.Timestamp;

public class Message implements DatabaseObject {

	private long id;
	private String text;
	private Timestamp createdAt;
	private String place;
	private MessageOwner messageOwner;
	private long tweetId;
	private boolean isRetweet;
	
	/**
	 * The Real constructor for a Messgae Object.
	 * @param id The id of the message. 
	 * @param text The text in the message. 
	 * @param createdAt The date the message is created. 
	 * @param place The place the message is send from. 
	 * @param messageOwner The Owner of the message. 
	 * @param tweetId The tweetId from the twitter db. 
	 * @param isRetweet A boolean that determines if a tweet is a RE.
	 */
	public Message(long id, String text, Timestamp createdAt, String place,
			MessageOwner messageOwner, long tweetId, boolean isRetweet) {
		this.id = id;
		this.text = text;
		this.createdAt = createdAt;
		this.place = place;
		this.messageOwner = messageOwner;
		this.tweetId = tweetId;
		this.isRetweet = isRetweet;
	}

	/**
	 * Creates a fake Message Object when an SQLException occurs.
	 */
	public Message() {
		this.id = -1;
		this.text = "";
		this.createdAt = new Timestamp(0);
		this.place = "";
		this.messageOwner = new MessageOwner();
		this.tweetId = -1;
		this.isRetweet = false;
	}

	public long getId() {
		return id;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public Timestamp getCreatedAt() {
		return createdAt;
	}

	public void setCreatedAt(Timestamp createdAt) {
		this.createdAt = createdAt;
	}

	public String getPlace() {
		return this.place;
	}

	public void setPlace(String place) {
		this.place = place;
	}

	public MessageOwner getMessageOwner() {
		return messageOwner;
	}

	public void setMessageOwner(MessageOwner messageOwner) {
		this.messageOwner = messageOwner;
	}

	public long getTweetId() {
		return tweetId;
	}

	public void setTweetId(long tweetId) {
		this.tweetId = tweetId;
	}

	public boolean getIsRetweet() {
		return isRetweet;
	}

	public void setIsRetweet(boolean isRetweet) {
		this.isRetweet = isRetweet;
	}
}